﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Cosmetic.Logic;
using Cosmetic.DataEntity;
using System.Collections.Generic;

namespace WebApp.Controls
{
    public partial class LeftToolBar : System.Web.UI.UserControl
    {
        CategoryManager CM = new CategoryManager();
        protected void Page_Load(object sender, EventArgs e)
        {
            BindCosmetic();
            BindCloth();
            BindSmallGoods();
            BindMisc();
        }

        private void BindCosmetic()
        {   //美妆
            //0D389509-A01C-4F12-A159-050C324AE9E7
            string cosmetic = CM.GetCategoryByName("美妆").CategoryId.ToString();
            this.HLCosmetic.NavigateUrl = "~/Product/CategoryToCategory.aspx?CID=" + cosmetic;

            List<Category> cates = CM.GetUpCategoryBySupCategoryID(new Guid("FF969AC4-80F5-46F9-A925-F5B73A867C19"));

            this.RptCosmetic.DataSource = cates;
            this.RptCosmetic.DataBind();
        }

        private void BindCloth()
        {   //服饰
            //5B83AC9C-B471-42A2-8502-FB60B7F3BF17
            string cloth = CM.GetCategoryByName("服饰").CategoryId.ToString();
            this.HLCloth.NavigateUrl = "~/Product/CategoryToCategory.aspx?CID=" + cloth;

            List<Category> cates = CM.GetUpCategoryBySupCategoryID(new Guid("5B83AC9C-B471-42A2-8502-FB60B7F3BF17"));

            this.RptCloth.DataSource = cates;
            this.RptCloth.DataBind();          
        }

        private void BindSmallGoods()
        {   //小商品
            //0D389509-A01C-4F12-A159-050C324AE9E7
            string smallgoods = CM.GetCategoryByName("小商品").CategoryId.ToString();
            this.HLSmallGoods.NavigateUrl = "~/Product/CategoryToCategory.aspx?CID=" + smallgoods;


            List<Category> cates = CM.GetUpCategoryBySupCategoryID(new Guid("0D389509-A01C-4F12-A159-050C324AE9E7"));

            this.RptSmallGoods.DataSource = cates;
            this.RptSmallGoods.DataBind();        
        }

        private void BindMisc()
        {
            //杂货
            //5AD61DCA-FD3D-494B-97E9-44A9AC05FC8E
            string misc = CM.GetCategoryByName("杂货").CategoryId.ToString();
            this.HLMisc.NavigateUrl = "~/Product/CategoryToCategory.aspx?CID=" + misc;
            

            List<Category> cates = CM.GetUpCategoryBySupCategoryID(new Guid("5AD61DCA-FD3D-494B-97E9-44A9AC05FC8E"));

            this.RptMisc.DataSource = cates;
            this.RptMisc.DataBind(); 
        }

        protected void LinkButton1_Click(object sender, EventArgs e)
        {//10元以下

        }

        protected void LinkButton2_Click(object sender, EventArgs e)
        {//10元-20元

        }

        protected void LinkButton3_Click(object sender, EventArgs e)
        {//20元-50元

        }

        protected void LinkButton4_Click(object sender, EventArgs e)
        {//50元-100元

        }

        protected void LinkButton5_Click(object sender, EventArgs e)
        {//100元-200元

        }

        protected void LinkButton6_Click(object sender, EventArgs e)
        {//200元以上

        }

    }
}